//
//  CollectionViewCell.m
//  ijkPlayer
//
//  Created by apple on 2018/5/11.
//  Copyright © 2018年 锦. All rights reserved.
//

#import "CollectionViewCell.h"

@implementation CollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self imageView];
    }
    return self;
}
- (UIImageView *)imageView {
    if (!_imageView) {
        _imageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, 5, self.frame.size.height- 10, self.frame.size.height- 10)];
        _imageView.backgroundColor = [UIColor yellowColor];
        
        _nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.frame.size.height + 10, self.frame.size.height / 2 - 35, 200, 30)];
        _nameLabel.font = [UIFont systemFontOfSize:14];
        _nameLabel.text = @"视频名称";
        
        _timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.frame.size.height + 10, self.frame.size.height / 2 + 5 , 200, 20)];
        _timeLabel.font = [UIFont systemFontOfSize:12];
        _timeLabel.text = @"--:--";
        
        _meanLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.frame.size.height + 10, self.frame.size.height / 2 + 30 , 200, 20)];
        _meanLabel.font = [UIFont systemFontOfSize:12];
        _meanLabel.text = @"--:--";
        
        _testBtn = [[UIButton alloc]initWithFrame:CGRectMake(self.frame.size.width - 110, 5, 100, 30)];
        [_testBtn setTitle:@"详细数据" forState:UIControlStateNormal];
        [_testBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
        _testBtn.titleLabel.font = [UIFont systemFontOfSize:12];
        
        [self.contentView addSubview:_imageView];
        [self.contentView addSubview:_nameLabel];
        [self.contentView addSubview:_timeLabel];
        [self.contentView addSubview:_meanLabel];
        [self.contentView addSubview:_testBtn];
    }
    return _imageView;
}
- (UIView *)selectedView {
    if (!_selectedView) {
        _selectedView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        _selectedView.backgroundColor = [UIColor blackColor];
        _selectedView.alpha = .3;
        _selectedView.hidden = YES;
        [self.contentView insertSubview:_selectedView atIndex:0];
    }
    return _selectedView;
}
//- (void)awakeFromNib {
//    [super awakeFromNib];
//    // Initialization code
//}

@end
